<template>
	<view style="display: flex;">
		<van-sidebar :active-key="activeKey" @change="onChange">
			<van-sidebar-item title="可回收物" />
			<van-sidebar-item title="湿垃圾" />
			<van-sidebar-item title="干垃圾" />
			<van-sidebar-item title="有害垃圾" />
		</van-sidebar>
		<view class="main">
			<uni-item :item="selectitem[0]" />
		</view>
	</view>
</template>

<script>
	import uniItem from './item.vue';
	export default {
		components: {
			uniItem
		},
		data() {
			return {
				selectitem: [],
				activeKey: 0,
				datalist: [{
						id: 0,
						title: "可回收物",
						desc: "可回收物就是可以再生循环的垃圾。本身或材质可再利用的纸类、硬纸板、玻璃、塑料、金属、塑料包装，与这些材质有关的如：报纸、杂志、广告单及其它干净的纸类等皆可回收",
						children: [{
								id: 11,
								title: "废纸",
								main: ["报纸", "杂志", "图书图书", "各种包装纸", "办公用纸", "纸盒"]
							},
							{
								id: 12,
								title: "塑料",
								main: ["塑料袋", "塑料包装物", "次性塑料餐盒"],
							},
							{
								id: 13,
								title: "玻璃",
								main: ["玻璃容器", "无色玻璃", "绿色玻璃"]
							},
							// {
							// 	id: 14,
							// 	title: "废纸",
							// 	main: ["报纸", "杂志", "图书图书", "各种包装纸", "办公用纸", "纸盒"]
							// },
							// {
							// 	id: 15,
							// 	title: "塑料",
							// 	main: ["塑料袋", "塑料包装物", "次性塑料餐盒"],
							// },
							// {
							// 	id: 16,
							// 	title: "玻璃",
							// 	main: ["玻璃容器", "无色玻璃", "绿色玻璃"]
							// },
						],
					},
					{
						id: 1,
						title: "湿垃圾",
						desc: "包括剩菜剩饭、骨头、菜根菜叶、果皮等食品类废物。经生物技术就地处理堆肥，每吨可生产0.6~0.7吨有机肥料。",
						children: [
							{
								id: 21,
								title: "湿垃圾",
								main: ["剩饭剩菜","面包","蛋糕饼干","果核","动物内脏","鸡肉","干果仁","剩饭剩菜","面包","蛋糕饼干","果核","动物内脏","鸡肉","剩饭剩菜","面包","蛋糕饼干","果核","动物内脏","鸡肉","干果仁"
								]
							},
						],
					}, {
						id: 2,
						title: "干垃圾",
						desc: "干垃圾即其它垃圾，指除可回收物、有害垃圾、厨余垃圾（湿垃圾）以外的其它生活废弃物。",
						children: [{
								id: 31,
								title: "干垃圾",
								main: ["餐巾纸","卫生间用纸","尿不湿","猫砂","狗尿垫","污损纸张","餐巾纸","卫生间用纸","尿不湿","猫砂","狗尿垫","污损纸张","餐巾纸","卫生间用纸","尿不湿","猫砂","狗尿垫","污损纸张","餐巾纸","卫生间用纸","尿不湿","猫砂","狗尿垫","污损纸张",]
							},
						],
					},
					{
						id: 3,
						title: "有害垃圾",
						desc: "有害垃圾指废电池、废灯管、废药品、废油漆及其容器等对人体健康或者自然环境造成直接或者潜在危害的生活废弃物。",
						children: [{
								id: 41,
								title: "电池",
								main: ["充电电池", "镍电池", "铅酸电池", "蓄电池", "纽扣电池"]
							},
							{
								id: 42,
								title: "灯管",
								main: ["荧光（日光）灯管", "卤素灯"],
							},
							{
								id: 43,
								title: "废药品",
								main: ["过期药物", "药物胶囊", "药片", "药品内包装"]
							},
							// {
							// 	id: 44,
							// 	title: "电池",
							// 	main: ["充电电池", "镍电池", "铅酸电池", "蓄电池", "纽扣电池"]
							// },
							// {
							// 	id: 45,
							// 	title: "灯管",
							// 	main: ["荧光（日光）灯管", "卤素灯"],
							// },
							// {
							// 	id: 46,
							// 	title: "废药品",
							// 	main: ["过期药物", "药物胶囊", "药片", "药品内包装"]
							// },
						],
					},
				]
			}
		},
		created() {
			this.selectitem = this.datalist.filter(i => i.id == 0)
		},
		methods: {
			onChange(e) {
				this.activeKey = e.detail
				this.selectitem = this.datalist.filter(i => i.id == e.detail)
			}
		}
	}
</script>

<style scoped>
	.main {
		overflow-y: scroll;
		height: 100vh;
	}
</style>